package mr;

import java.io.BufferedReader;
import java.io.FileReader;
import java.util.ArrayList;
import java.util.HashMap;

public class Demo03ClazzSum {
    public static void main(String[] args)throws Exception {
        long start = System.currentTimeMillis();
        BufferedReader br = new BufferedReader(new FileReader("E:\\IDEJAVA\\mapreduce\\data\\bigstudent.txt"));
        String line;
        HashMap<String, Integer> map = new HashMap<String, Integer>();
        while ((line=br.readLine())!=null){
            String clazz = line.split(",")[4];
            if (!map.containsKey(clazz)){
                map.put(clazz,1);
            }else {
                map.put(clazz,map.get(clazz)+1);
            }
        }
        System.out.println(map);
        long end = System.currentTimeMillis();
        System.out.println(end-start);
    }
}
